package com.wuliu.framework.config;

import com.wuliu.framework.interceptor.I18nInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author realue
 * @version 1.0
 * @date 2023-10-13 17:37
 */
@Configuration
public class I18nConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器
        I18nInterceptor interceptor = new I18nInterceptor();
        InterceptorRegistration loginRegistry = registry.addInterceptor(interceptor);
        // 拦截路径
        loginRegistry.addPathPatterns("/**");
    }

}
